package com.by.controller;

import com.by.bean.Coupon;
import com.by.common.core.bean.ResultBean;
import com.by.common.core.controller.BaseController;
import com.by.service.CouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 优惠券控制层
 */
@RestController
@Api(tags = "优惠券管理")
@RequestMapping("/cp")
public class CouponController extends BaseController {
    @Autowired
    CouponService couponService;

    /**
     * 保存优惠券
     * @param coupon
     * @return
     */
    @ApiOperation("保存优惠券")
    @PostMapping("/saveCoupon")
   public ResultBean saveCoupon(@RequestBody Coupon coupon){
       int rs=couponService.saveEntity(coupon);
       return saveResult(rs);
   }

}
